package com.abel.quiz.interceptors;

import org.springframework.aop.ThrowsAdvice;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.reflect.Method;

/**
 * @param
 * @author abel.lin
 * @description 错误拦截器
 * @date_time 2017/8/4 11:37
 */
public class ExceptionAdvisor implements ThrowsAdvice {



	public void afterThrowing(Method method, Object[] args, Object target,
							  Exception ex) throws Throwable{

		/*Logger log = LoggerFactory.getLogger(target.getClass());

		log.info("Error happened in class: " + target.getClass().getName());
		log.info("Error happened in method: " + method.getName());
		for (int i = 0; i < args.length; i++) {
			log.info("arg[" + i + "]: " + args[i]);
		}
		log.info("Exception class: " + ex.getClass().getName());

		StringWriter sw = new StringWriter();
		ex.printStackTrace(new PrintWriter(sw));
		String stackTrace = sw.toString();*/

	}
}
